﻿using System.Collections.Generic;
using Cygida.Environment.DataAccess;
using WallpaperSharing.DataAccess.Interfaces;
using WallpaperSharing.Domain;

namespace WallpaperSharing.DataAccess
{
    public class WallpaperCategoryDao : DaoBase, IWallpaperCategoryDao
    {
        public WallpaperCategoryDao()
            : this(DataSources.Manhattan)
        { }

        public WallpaperCategoryDao(IBaseDataSource dataSource)
            : base(dataSource)
        { }

        public IList<WallpaperCategory> SelectAll()
        {
            return DataSource.QueryForList<WallpaperCategory>("SelectAllWallpaperCategories", null);
        }

        public WallpaperCategory SelectById(int id)
        {
            return DataSource.QueryForObject<WallpaperCategory>("SelectWallpaperCategoryById", id);
        }

        public void Insert(WallpaperCategory domain)
        {
            DataSource.Insert("InsertWallpaperCategory", domain);
        }

        public void Update(WallpaperCategory domain)
        {
            DataSource.Update("UpdateWallpaperCategory", domain);
        }

        public void Delete(int id)
        {
            DataSource.Delete("DeleteWallpaperCategory", id);
        }
    }
}
